
window.onload = function () {
    // 获取系统时间
    var nowdate = "更新时间：" + getNowFormatDate();
    $("#nowdate").html(nowdate);

    //获取今日天气
    GetTodayAir(2000);

    //获取未来天气预测
    GetForeCast();

    $.demo.data.Get_AQI_Hour();
    $.demo.data.Get_AQI_Day();
    $.demo.data.Get_AQI_Year();
    $.demo.data.Get_CantonAverageAQI();
    $.demo.data.Get_Obj_Station();
    $.demo.data.Get_WQ_Station();
    $.demo.data.Get_JS_FS();
    $.demo.data.Get_YDL();
    $.demo.data.Get_JS_FS_Year();
    $.demo.data.Get_time();
    $.demo.data.Get_GY_SITE();

    //mapInit();
    // 空气质量
    airChart();
    // 水质达标
    waterChart();
    // 噪声构成
    noiseChart();
    // 排污情况
    polluteChart();
    // 空气监测
    //airMonitor();
    // PM2.5浓度
    //pmChart();
    // 空气指标分析
    airAnalysis();


    $.hb.Get_GYWR_TOP();

    setTimeout(function () {
        $.hb.setobjMonthPicTotal_fengxi();
        $.hb.setobjMonthPicTotal();
        //$.hb.showClusterData_poi();
        $.demo.mapInit();
    }, 1000)

    //function getDays() {
    //    var date = new Date();
    //    var s1 = date.getFullYear() + "-01-01";

    //    s1 = new Date(s1.replace(/-/g, "/"));

    //    var times = date.getTime() - s1.getTime();
    //    var days = parseInt(times / (1000 * 60 * 60 * 24));

    //    return days;
    //}

    // 区域点击事件
    AreaClickInit();
    // 主题点击事件
    SubjectClickInit();
}

//获取今日天气
function GetTodayAir(areaCode) {
    $.ajax({
        type: "get",
        dataType: "text",
        url: ACTION_URL("GetTodayAir", "HuanBao"),
        data: {
            areaCode: areaCode
        },
        async: false, //修改Ajax请求为同步
        success: function (data) {
            // 由JSON字符串转换为JSON对象
            var dataJSON = eval("(" + data + ")").data;
            $("#airDescript").html(dataJSON[0].descript);
            $("#aqiIndex").html(dataJSON[0].aqi);
            $("#mainPollution").html(dataJSON[0].mainPollution);
            $("#nongdu").html(dataJSON[0].nongdu);
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            //alert(errorThrown);
        }
    });
}

//获取未来空气质量预测
function GetForeCast() {
    $.ajax({
        type: "get",
        dataType: "text",
        //url: "../HuanBao/GetForecast",
        url: ACTION_URL("GetForecast", "HuanBao"),
        async: false, //修改Ajax请求为同步
        success: function (data) {
            // 由JSON字符串转换为JSON对象
            var dataJSON = eval("(" + data + ")").data;
            for (var i = 0; i < dataJSON.length; i++) {
                $("#aqi_forecast" + (i + 1)).html(dataJSON[i].aqi);
                if (dataJSON[i].forecast == "优") {
                    //$("#forecast" + (i + 1)).html("<img src='../Content/huanbao/images/good.png' />");
                    $("#forecast" + (i + 1)).html('<img src="' + CONTENT_URL("Content/huanbao/images/good.png") + '" />');
                }
                else if (dataJSON[i].forecast == "良") {
                    //$("#forecast" + (i + 1)).html("<img src='../Content/huanbao/images/liang.png' />");
                    $("#forecast" + (i + 1)).html('<img src="' + CONTENT_URL("Content/huanbao/images/liang.png") + '" />');
                }
                else {
                    //$("#forecast" + (i + 1)).html("<img src='../Content/huanbao/images/bad.png' />");
                    $("#forecast" + (i + 1)).html('<img src="' + CONTENT_URL("Content/huanbao/images/bad.png") + '" />');
                }
            }
            var date = new Date();
            date.setDate(new Date().getDate() + 3);
            var month = date.getMonth() + 1;
            var day = date.getDate();
            $("#day_forecast1").html(month + "月" + day + "日");

            date.setDate(new Date().getDate() + 2);
            month = date.getMonth() + 1;
            day = date.getDate();
            $("#day_forecast2").html(month + "月" + day + "日");

            date.setDate(new Date().getDate() + 1);
            month = date.getMonth() + 1;
            day = date.getDate();
            $("#day_forecast3").html(month + "月" + day + "日");

        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            //alert(errorThrown);
        }
    });
}

// 区域点击事件
function AreaClickInit() {
    $(".fleft.lfarea li").click(function () {
        var index = $(this).index();
        $(".fleft.lfarea li a").removeClass("onclic_area");
        $(this).children("a").addClass("onclic_area");

        switch (index) {
            case 0:
                AirHour($.demo.data.Hour_2000); //市区
                break;
            case 1:
                AirHour($.demo.data.Hour_2003); //秦淮区
                break;
            case 2:
                AirHour($.demo.data.Hour_2001); //鼓楼区
                break;
            case 3:
                AirHour($.demo.data.Hour_2004); //玄武区
                break;
            case 4:
                AirHour($.demo.data.Hour_2009); //建邺区
                break;
            case 5:
                AirHour($.demo.data.Hour_2002); //雨花区
                break;
            case 6:
                AirHour($.demo.data.Hour_2016); //江宁区
                break;
            case 7:
                AirHour($.demo.data.Hour_2010); //浦口区
                break;
            case 8:
                AirHour($.demo.data.Hour_2008); //栖霞区
                break;
            case 9:
                AirHour($.demo.data.Hour_2022); //六合区
                break;
            case 10:
                AirHour($.demo.data.Hour_2024); //溧水区
                break;
            case 11:
                AirHour($.demo.data.Hour_2013); //高淳区
                break;
        }
    })
}

// 空气监测根据区域显示
function AirHour(hourObj) {
    var data_aqi = [];
    var data_pm25 = [];
    var data_pm10 = [];
    var data_so2 = [];
    var data_no2 = [];
    var data_co = [];
    var data_o3 = [];
    var x = [];
    var id;
    var time_index;

    var color = "";
    for (var j = 0; j < hourObj.length ; j++) {
        var time = new Date(parseInt(hourObj[j].HOUR.replace("/Date(", "").replace(")/", ""))).getHours();
        var y = hourObj[j].AQI;
        var t = hourObj[j].PM25;
        var p = hourObj[j].PM10;
        var s = hourObj[j].SO2;
        var n = hourObj[j].NO2;
        var c = hourObj[j].CO;
        var o = hourObj[j].O3_8;

        data_aqi.push(y)
        data_pm25.push(t)
        data_pm10.push(p)
        data_so2.push(s)
        data_no2.push(n)
        data_co.push(c)
        data_o3.push(o)
        x.push(time + ":00");
    }
    var u = new Date(parseInt(hourObj[0].HOUR.replace("/Date(", "").replace(")/", "")));
    var u_last = new Date(parseInt(hourObj[hourObj.length - 1].HOUR.replace("/Date(", "").replace(")/", "")));
    time_index = (u_last.getMonth() + 1) + "月" + u_last.getDate() + "日" + u_last.getHours() + "时至" + (u.getMonth() + 1) + "月" + u.getDate() + "日" + u.getHours() + "时";
    //time_index = "12/23"+"&nbsp;&nbsp;&nbsp;"+ "21：00～" + "12/31"+ "&nbsp;&nbsp;&nbsp;"+ "23：00";

    var name_1 = "AQI";
    var name_2 = "PM2.5";
    x.reverse();
    data_aqi = data_aqi.reverse();
    data_pm25 = data_pm25.reverse();
    data_pm10 = data_pm10.reverse();
    data_so2 = data_so2.reverse();
    data_no2 = data_no2.reverse();
    data_co = data_co.reverse();
    data_o3 = data_o3.reverse();

    airMonitor(x, data_aqi, data_pm25, data_o3)
}

// 主题点击事件
function SubjectClickInit() {
    $(".right_tit span").click(function () {
        var index = $(this).index();
        $(".right_tit span").removeClass("zhuanti_now");
        $(this).addClass("zhuanti_now");
        $(".abox").css("display", "none");
        $(".abox:eq(" + index + ")").css("display", "block");
        switch (index) {
            case 0:
                // 空气质量
                airChart();
                // 水质达标
                waterChart();
                // 噪声构成
                noiseChart();
                // 排污情况
                polluteChart();
                // 空气监测
                //airMonitor();
                // PM2.5浓度
                //pmChart();
                // 空气指标分析
                airAnalysis();
                break;
            case 1:
                // 首要污染物分析
                GetMainPollutionDays();
                // 空气质量天数比例
                GetAirQualityDays();
                // 空气质量优良率
                airQualityChart();
                break;
            case 2:
                // 水质达标情况
                //waterQuality();
                $.demo.data.Get_FS_TOP();
                $.demo.data.Get_SZ_INFO();
                setTimeout(function () { SZ_infoChart(); }, 1000)
                break;
            case 3:
                // 交通噪声年度趋势图
                trafficnoiseTrend();
                // 环境噪声年度趋势图
                environmentnoiseTrend();
                break;
        }
    })
}

function mapInit() {
    $("#map").css({
        height: "910px",
        width: "1295px"
    })

    L.tileLayer.YLC = function (options) {
        return new L.TileLayer.YLC(options);
    };

    L.TileLayer.YLC = L.TileLayer.extend({
        options: {
            mapFrom: "autonavi"
        },
        initialize: function (options) { // (String, Object)
            L.setOptions(this, options);
        },
        getTileUrl: function (tilePoint) {
            return L.Util.template(ACTION_URL("LoadMapGetPng", "Home") + '?type={type}&x={x}&y={y}&z={z}', L.extend({
                type: this.options.mapFrom,
                z: tilePoint.z,
                x: tilePoint.x,
                y: tilePoint.y
            }, this.options));
        }
    })

    this.map = $.tMap.init("map", $.extend({
        defaultLayer: function () {
            return [L.tileLayer.YLC({ mapFrom: "autonavi" }), L.tileLayer.YLC({ mapFrom: "autonavi" })];
        }
    }))

    $.demo.showClusterData();

    //this.map = $.tMap.init("map", {
    //    defaultLayer: "autonavi",
    //})
    //$.demo.map.setView("118.8525", "32.06534", 13);
    //setTimeout(function () {
    //    //$.demo.showHeatmap(0);
    //    //$.demo.showJiance();
    //    $.demo.showClusterData();
    //    //$.demo.showArea();
    //}, 2000)


    //this.map.map.on("click", function (evt) {
    //    console.log("点击坐标:" + evt.latlng.lng + "," + evt.latlng.lat);
    //})


}

// 获取系统时间
function getNowFormatDate() {
    var date = new Date();
    var seperator1 = "-";
    var seperator2 = ":";
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }
    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
            + " " + date.getHours() + seperator2 + date.getMinutes()
            + seperator2 + date.getSeconds();
    return currentdate;
}

// 空气质量
function airChart() {
    var myChart = echarts.init(document.getElementById('chart_air'));
    var option = {
        tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b}({c}%)"
        },
        legend: {
            orient: 'vertical',
            x: 'left',
            data: null
        },
        title: {
            text: '294天',
            x: 'center',
            y: 'center',
            textStyle: {
                fontSize: '12',
                fontWeight: 'bold',
                color: '#fff'
            }
        },
        series: [
            {
                name: '空气质量',
                type: 'pie',
                radius: ['50%', '70%'],
                avoidLabelOverlap: false,
                label: {
                    normal: {
                        show: false,
                        position: 'center'
                    },
                    emphasis: {
                        show: false,  // 设置圆环中间文字是否显示
                        textStyle: {
                            fontSize: '9',
                            fontWeight: 'bold'
                        }
                    }
                },
                labelLine: {
                    normal: {
                        show: false
                    }
                },
                data: [
                    { value: 22, name: '22天' },
                    { value: 61, name: '61天' },
                    { value: 90, name: '90天' },
                    { value: 192, name: '192天' }
                ],
                itemStyle: {
                    normal: {
                        color: function (params) {
                            var colorList = [
                               '#fca61d', '#ff035d', '#93dd60', '#ecd406'
                            ];
                            return colorList[params.dataIndex]
                        }
                    }
                }
            }
        ]
    };
    myChart.setOption(option);
}

// 水质监测
function waterChart() {
    var myChart = echarts.init(document.getElementById('chart_water'));
    var option = {
        tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b}({c}%)"
        },
        legend: {
            orient: 'vertical',
            x: 'left',
            data: null
        },
        title: {
            text: '113个',
            x: 'center',
            y: 'center',
            textStyle: {
                fontSize: '12',
                fontWeight: 'bold',
                color: '#fff'
            }
        },
        series: [
            {
                name: '水质达标情况',
                type: 'pie',
                radius: ['50%', '70%'],
                avoidLabelOverlap: false,
                label: {
                    normal: {
                        show: false,
                        position: 'center'
                    },
                    emphasis: {
                        show: false,  // 设置圆环中间文字是否显示
                        textStyle: {
                            fontSize: '9',
                            fontWeight: 'bold'
                        }
                    }
                },
                labelLine: {
                    normal: {
                        show: false
                    }
                },
                data: [
                    { value: 47, name: '未达标：47个' },
                    { value: 66, name: '达标：66个' }
                ],
                itemStyle: {
                    normal: {
                        color: function (params) {
                            var colorList = [
                               '#fff', '#7bde74'
                            ];
                            return colorList[params.dataIndex]
                        }
                    }
                }
            }
        ]
    };
    myChart.setOption(option);
}

// 噪声监测
function noiseChart() {
    var myChart = echarts.init(document.getElementById('chart_noise'));
    var option = {
        tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b}({c}%)"
        },
        legend: {
            orient: 'vertical',
            x: 'left',
            data: null
        },
        title: {
            text: '100%',
            x: 'center',
            y: 'center',
            textStyle: {
                fontSize: '12',
                fontWeight: 'bold',
                color: '#fff'
            }
        },
        series: [
            {
                name: '噪声构成',
                type: 'pie',
                radius: ['50%', '70%'],
                avoidLabelOverlap: false,
                label: {
                    normal: {
                        show: false,
                        position: 'center'
                    },
                    emphasis: {
                        show: false,  // 设置圆环中间文字是否显示
                        textStyle: {
                            fontSize: '12',
                            fontWeight: 'bold'
                        }
                    }
                },
                labelLine: {
                    normal: {
                        show: false
                    }
                },
                data: [
                    { value: 6, name: '6%' },
                    { value: 4, name: '4%' },
                    { value: 12, name: '12%' },
                    { value: 78, name: '78%' }
                ],
                itemStyle: {
                    normal: {
                        color: function (params) {
                            var colorList = [
                               '#85ab62', '#e1535f', '#00b4e3', '#9f41b3'
                            ];
                            return colorList[params.dataIndex]
                        }
                    }
                }
            }
        ]
    };
    myChart.setOption(option);
}

// 排污情况
function polluteChart() {
    var myChart = echarts.init(document.getElementById('chart_pollute'));
    var option = {
        tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b}({c}吨)"
        },
        legend: {
            orient: 'vertical',
            x: 'left',
            data: null
        },
        title: {
            text: '2587吨',
            x: 'center',
            y: 'center',
            textStyle: {
                fontSize: '12',
                fontWeight: 'bold',
                color: '#fff'
            }
        },
        series: [
            {
                name: '排污情况',
                type: 'pie',
                radius: ['50%', '70%'],
                avoidLabelOverlap: false,
                label: {
                    normal: {
                        show: false,
                        position: 'center'
                    },
                    emphasis: {
                        show: false,  // 设置圆环中间文字是否显示
                        textStyle: {
                            fontSize: '9',
                            fontWeight: 'bold'
                        }
                    }
                },
                labelLine: {
                    normal: {
                        show: false
                    }
                },
                data: [
                    { value: 547, name: '超标' },
                    { value: 2587, name: '总量' }
                ],
                itemStyle: {
                    normal: {
                        color: function (params) {
                            var colorList = [
                               '#cd3b3b', '#fff'
                            ];
                            return colorList[params.dataIndex]
                        }
                    }
                }
            }
        ]
    };
    myChart.setOption(option);
}

// 空气监测
function airMonitor(time, aqi, pm25, o3) {
    var myChart = echarts.init(document.getElementById('airMonitor'));
    var option = {
        tooltip: {
            trigger: 'axis'
        },
        calculable: true,
        // 设置页边距
        grid: {
            top: '3%',
            left: '3%',
            right: '3%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: [
            {
                type: 'category',
                boundaryGap: false,
                data: time,
                //设置坐标轴字体颜色  
                axisLabel: {
                    textStyle: {
                        color: '#fff'
                    }
                },
                //设置坐标轴颜色 
                axisLine: {
                    lineStyle: {
                        color: '#fff',
                        width: 2
                    }
                },
                splitLine: { show: false } //去掉背景网格
            }
        ],
        yAxis: [
            {
                type: 'value',
                //设置坐标轴字体颜色  
                axisLabel: {
                    textStyle: {
                        color: '#fff'
                    }
                },
                //设置坐标轴颜色 
                axisLine: {
                    lineStyle: {
                        color: '#fff',
                        width: 2
                    }
                },
                splitLine: { show: false } //去掉背景网格
            }
        ],
        series: [
            {
                name: 'O3',
                type: 'line',
                smooth: true,
                itemStyle: {
                    normal: {
                        areaStyle: {
                            type: 'default',
                            color: '#cb9c1a'
                        }
                    }
                },
                data: o3
            },
            {
                name: 'AQI',
                type: 'line',
                smooth: true,
                itemStyle: {
                    normal: {
                        areaStyle: {
                            type: 'default',
                            color: '#cd0567'
                        }
                    }
                },
                data: aqi
            },
            {
                name: 'PM2.5',
                type: 'line',
                smooth: true,
                itemStyle: {
                    normal: {
                        areaStyle: {
                            type: 'default',
                            color: '#1caec5'
                        }
                    }
                },
                data: pm25
            }

        ]
    };
    myChart.setOption(option);
}

// 空气质量指标分析
function airAnalysis() {
    var myChart = echarts.init(document.getElementById('indexAnalysis'));
    var option = {
        tooltip: {
            trigger: 'axis'
        },
        //legend: {
        //    data: ['邮件营销', '联盟广告', '视频广告', '直接访问', '搜索引擎']
        //},
        calculable: true,
        // 设置页边距
        grid: {
            top: '5%',
            left: '3%',
            right: '5%',
            bottom: '7%',
            containLabel: true
        },
        xAxis: [
            {
                type: 'category',
                boundaryGap: false,
                data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
                //设置坐标轴字体颜色  
                axisLabel: {
                    textStyle: {
                        color: '#fff'
                    }
                },
                //设置坐标轴颜色 
                axisLine: {
                    lineStyle: {
                        color: 'yellow',
                        width: 2
                    }
                },
                splitLine: { show: false } //去掉背景网格
            }
        ],
        yAxis: [
            {
                type: 'value',
                //设置坐标轴字体颜色  
                axisLabel: {
                    textStyle: {
                        color: '#fff'
                    }
                },
                //设置坐标轴颜色
                axisLine: {
                    lineStyle: {
                        color: 'yellow',
                        width: 2
                    }
                },
                splitLine: { show: false } //去掉背景网格
            }
        ],
        color: ['#f20201', '#ec9301', '#05ff0a'],
        series: [
            {
                name: 'AOI',
                type: 'line',
                smooth: true,
                data: [220, 182, 191, 234, 290, 330, 310, 120, 150, 140, 210, 230]
            },
            {
                name: '降水量',
                type: 'line',
                smooth: true,
                data: [150, 232, 201, 154, 190, 330, 410, 420, 250, 230, 200, 210]
            },
            {
                name: '风速',
                type: 'line',
                smooth: true,
                data: [120, 132, 101, 134, 90, 230, 210, 120, 140, 178, 134, 112]
            }

        ]
    };

    myChart.setOption(option);
}

// PM2.5浓度
function pmChart() {
    var myChart = echarts.init(document.getElementById('chart_pm'));
    var option = {
        tooltip: {
            trigger: 'axis'
        },
        calculable: false,
        // 设置页边距
        grid: {
            top: '10%',
            left: '3%',
            right: '3%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: [
            {
                type: 'category',
                data: ['2013年', '2014年', '2015年', '2016年'],
                //设置坐标轴字体颜色  
                axisLabel: {
                    textStyle: {
                        color: '#fff'
                    }
                },
                //设置坐标轴颜色 
                axisLine: {
                    lineStyle: {
                        color: '#fff',
                        width: 2
                    }
                },
                splitLine: { show: false } //去掉背景网格
            }
        ],
        yAxis: [
            {
                type: 'value',
                //设置坐标轴字体颜色  
                axisLabel: {
                    textStyle: {
                        color: '#fff'
                    }
                },
                //设置坐标轴颜色 
                axisLine: {
                    lineStyle: {
                        color: '#fff',
                        width: 2
                    }
                },
                splitLine: { show: false } //去掉背景网格
            }
        ],
        series: [
            {
                name: 'PM2.5浓度',
                type: 'bar',
                barMaxWidth: 50,
                data: [78, 74, 40.95, 33.5],
                //markPoint: {
                //    data: [
                //        { type: 'max', name: '最大值' },
                //        { type: 'min', name: '最小值' }
                //    ]
                //},
                itemStyle: {
                    normal: {
                        color: function (params) {
                            var colorList = [
                               '#02abae', '#b77f2a', '#90b72a', '#a82396'
                            ];
                            return colorList[params.dataIndex]
                        },
                        label: {  //柱状图是否显示数值
                            show: true,
                            position: 'top',
                            textStyle: {
                                fontSize: '15'
                            }
                        }
                    }
                }
                //markLine: {
                //    data: [
                //        { type: 'average', name: '平均值' }
                //    ]
                //}
            }
        ]
    };
    myChart.setOption(option);
}

// 获取首要污染物天数
function GetMainPollutionDays() {
    var year = new Date().getFullYear();
    $.ajax({
        type: "get",
        dataType: "text",
        url: ACTION_URL('GetMainPollutionDays', 'HuanBao'),
        data:{
            year:year
        },
        async: false, //修改Ajax请求为同步
        success: function (data) {
            // 由JSON字符串转换为JSON对象
            var dataJSON = eval("(" + data + ")").data;
            var param = [];
            param.push({ value: dataJSON[0].no2, name: 'NO2\n' + dataJSON[0].no2 + '天' });
            param.push({ value: dataJSON[0].pm10, name: 'PM10\n' + dataJSON[0].pm10 + '天' });
            param.push({ value: dataJSON[0].pm25, name: 'PM2.5\n' + dataJSON[0].pm25 + '天' });
            param.push({ value: dataJSON[0].o3, name: 'O3\n' + dataJSON[0].o3 + '天' });

            // 调用echarts生成饼图
            mainPullutionChart(param)

        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            //alert(errorThrown);
        }
    });
}


// 首要污染物分析
function mainPullutionChart(data) {
    var myChart = echarts.init(document.getElementById('mainPullution'));
    var option = {
        //tooltip: {
        //    trigger: 'item',
        //    formatter: "{a} <br/>{b} : {c} ({d}%)"
        //},
        calculable: false,
        color: ['#97b553', '#ffb880', '#d77b80', '#e6cf0d'],
        series: [
            {
                name: null,
                type: 'pie',
                radius: [20, 120],
                roseType: 'radius',
                data: data,
                label: {
                    normal: {
                        textStyle: {
                            fontSize: '12',
                            fontWeight: 'bold'
                        }
                    }
                    //emphasis: {                        
                    //    textStyle: {
                    //        fontSize: '14',
                    //        fontWeight: 'bold'
                    //    }
                    //}
                }
            }

        ]
    };
    myChart.setOption(option);
}

// 获取空气质量天数比例
function GetAirQualityDays() {
    var year = new Date().getFullYear();
    $.ajax({
        type: "get",
        dataType: "text",
        url: ACTION_URL('GetAirQualityDays', 'HuanBao'),
        data:{
            year: year
        },
        async: false, //修改Ajax请求为同步
        success: function (data) {
            // 由JSON字符串转换为JSON对象
            var dataJSON = eval("(" + data + ")").data;
            var data1 = [];
            var data2 = [];
            var data3 = [];
            var data4 = [];
            var data5 = [];
            var data6 = [];
            for (var i = 0; i < dataJSON.length; i++) {
                data1.push(dataJSON[i].so2);
                data2.push(dataJSON[i].no2);
                data3.push(dataJSON[i].pm10);
                data4.push(dataJSON[i].pm25);
                data5.push(dataJSON[i].co);
                data6.push(dataJSON[i].o3);
            }
            // 调用echarts生成柱状堆积图
            airDaysChart(data1, data2, data3, data4, data5, data6)

        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            //alert(errorThrown);
        }
    });
}

// 空气质量天数比例
function airDaysChart(data1, data2, data3, data4, data5, data6) {
    var barWidth = 30;
    var myChart = echarts.init(document.getElementById('airDays'));
    var option = {
        tooltip: {
            trigger: 'axis',
            axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        calculable: true,
        // 设置页边距
        grid: {
            top: '5%',
            left: '3%',
            right: '5%',
            bottom: '5%',
            containLabel: true
        },
        xAxis: [
            {
                type: 'category',
                data: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
                //设置坐标轴字体颜色  
                axisLabel: {
                    interval: 0,
                    textStyle: {
                        color: '#fff'
                    }
                },
                //设置坐标轴颜色 
                axisLine: {
                    lineStyle: {
                        color: '#fff',
                        width: 1
                    }
                },
                splitLine: { show: false } //去掉背景网格
            }
        ],
        yAxis: [
            {
                type: 'value',
                //设置坐标轴字体颜色  
                axisLabel: {
                    textStyle: {
                        color: '#fff'
                    }
                },
                //设置坐标轴颜色 
                axisLine: {
                    show: false,
                    lineStyle: {
                        color: '#fff',
                        width: 2
                    }
                },
                //splitLine: { show: false } //去掉背景网格
            }
        ],
        color: ['#57d782', '#ffb880', '#ffec93', '#ffa293', '#d83e26', '#911908'],
        series: [
            {
                name: 'SO2',
                type: 'bar',
                stack: '空气质量',
                barWidth: barWidth,
                data: data1
            },
            {
                name: 'NO2',
                type: 'bar',
                stack: '空气质量',
                barWidth: barWidth,
                data: data2
            },
            {
                name: 'PM10',
                type: 'bar',
                stack: '空气质量',
                barWidth: 30,
                data: data3
            },
            {
                name: 'PM2.5',
                type: 'bar',
                stack: '空气质量',
                barWidth: barWidth,
                data: data4
            },
            {
                name: 'CO',
                type: 'bar',
                stack: '空气质量',
                barWidth: barWidth,
                data: data5
            },
            {
                name: 'O3',
                type: 'bar',
                stack: '空气质量',
                barWidth: barWidth,
                data: data6
            }

        ]
    };
    myChart.setOption(option);
}

// 空气质量优良率
function airQualityChart() {
    var myChart = echarts.init(document.getElementById('airQuality'));
    var option = {
        grid: { height: 100 },
        series: [
            {
                name: '业务指标',
                type: 'gauge',
                center: ['50%', '60%'],    // 默认全局居中
                radius: 150,
                detail: {
                    formatter: '{value}%',
                    //offsetCenter: [0, '10%'],
                    textStyle: {
                        color: 'auto'
                        //fontSize: 20
                    }
                },
                data: [{
                    value: 10
                    //name: '63%'                    
                }]
            }
        ]
    };
    myChart.setOption(option);
}

//水质监测
function SZ_infoChart() {
    var myChart = echarts.init(document.getElementById('SZ_infoChart'));
    var option = {
        grid: { height: 100 },
        series: [
            {
                name: 'PH',
                type: 'gauge',
                center: ['27%', '25%'],    // 默认全局居中
                radius: 100,
                max: 14,
                detail: {
                    formatter: '{value}',
                    //offsetCenter: [0, '10%'],
                    textStyle: {
                        color: '#fff'
                        //fontSize: 20
                    }
                },
                data: [{
                    value: $.demo.data.SZ_INFO.PH,
                    name: 'PH值'
                }],
                title: {
                    show: true,
                    offsetCenter: [0, -30],       // x, y，单位px
                    textStyle: {
                        color: '#fff'
                    }
                }
            },
            {
                name: '溶解氧',
                type: 'gauge',
                center: ['73%', '25%'],    // 默认全局居中
                radius: 100,
                max: 25,
                detail: {
                    formatter: '{value}',
                    //offsetCenter: [0, '10%'],
                    textStyle: {
                        color: '#fff'
                        //fontSize: 20
                    }
                },
                data: [{
                    value: $.demo.data.SZ_INFO.RONGJIEYANG,
                    name: '溶解氧',
                }],
                title: {
                    show: true,
                    offsetCenter: [0, -30],       // x, y，单位px
                    textStyle: {
                        color: '#fff'
                    }
                }
            },
            {
                name: '浊度',
                type: 'gauge',
                center: ['27%', '68%'],    // 默认全局居中
                radius: 100,
                max: 1000,
                detail: {
                    formatter: '{value}',
                    //offsetCenter: [0, '10%'],
                    textStyle: {
                        color: '#fff'
                        //fontSize: 20
                    }
                },
                data: [{
                    value: $.demo.data.SZ_INFO.ZHUODU,
                    name: '浊度'
                }],
                title: {
                    show: true,
                    offsetCenter: [0, -30],       // x, y，单位px
                    textStyle: {
                        color: '#fff'
                    }
                }
            },
            {
                name: '温度',
                type: 'gauge',
                center: ['73%', '68%'],    // 默认全局居中
                radius: 100,
                max: 70,
                detail: {
                    formatter: '{value}',
                    //offsetCenter: [0, '10%'],
                    textStyle: {
                        color: '#fff'
                        //fontSize: 20
                    }
                },
                data: [{
                    value: $.demo.data.SZ_INFO.SHUIWEN,
                    name: '温度'
                }],
                title: {
                    show: true,
                    offsetCenter: [0, -30],       // x, y，单位px
                    textStyle: {
                        color: '#fff'
                    }
                }
            },
        ]
    };

    myChart.setOption(option);
}

// 交通噪声年度趋势图
function trafficnoiseTrend() {
    var myChart = echarts.init(document.getElementById('trafficnoiseTrend'));
    var option = {
        tooltip: {
            trigger: 'axis'
        },
        color: ['#cc7a1c', '#0670ad'],
        legend: {
            x: 400,
            data: [{
                name: '城区',
                textStyle: {
                    color: '#fff'
                }
            },
            {
                name: '郊区',
                textStyle: {
                    color: '#fff'
                }
            }]
        },
        // 设置页边距
        grid: {
            top: '10%',
            left: '3%',
            right: '5%',
            bottom: '5%',
            containLabel: true
        },
        calculable: true,
        xAxis: [
            {
                type: 'category',
                boundaryGap: false,
                data: ['2013年', '2014年', '2015年'],
                //设置坐标轴字体颜色  
                axisLabel: {
                    textStyle: {
                        color: '#fff'
                    }
                },
                //设置坐标轴颜色 
                axisLine: {
                    show: true,
                    lineStyle: {
                        color: 'yellow',
                        width: 2
                    }
                },
                splitLine: { show: false } //去掉背景网格
            }
        ],
        yAxis: [
            {
                type: 'value',
                min: 60,
                max: 75,
                yAxisIndex: 3, //刻度间隔             
                //设置坐标轴字体颜色  
                axisLabel: {
                    textStyle: {
                        color: '#fff'
                    }
                },
                //设置坐标轴颜色 
                axisLine: {
                    show: true,
                    lineStyle: {
                        color: 'yellow',
                        width: 2
                    }
                },
                splitLine: { show: false } //去掉背景网格                
            }
        ],
        series: [
            {
                name: '城区',
                type: 'line',
                symbolSize: 10,
                data: [68.4, 67.2, 67.8],
                itemStyle: {
                    normal: {
                        lineStyle: {
                            width: 2
                            //color: 'yellow'
                        }
                    }
                }
            },
            {
                name: '郊区',
                type: 'line',
                symbolSize: 10,
                data: [66.8, 67.6, 67.9],
                itemStyle: {
                    normal: {
                        lineStyle: {
                            width: 2
                            //color: 'yellow'
                        }
                    }
                }
            }
        ]
    };
    myChart.setOption(option);
}

// 环境噪声年度趋势图
function environmentnoiseTrend() {
    var myChart = echarts.init(document.getElementById('environmentnoiseTrend'));
    var option = {
        tooltip: {
            trigger: 'axis'
        },
        color: ['#cc7a1c', '#0670ad'],
        legend: {
            x: 400,
            itemStyle: {
                normal: {
                    lineStyle: {
                        width: 10
                    }
                }
            },
            data: [{
                name: '城区',
                textStyle: {
                    color: '#fff'
                }
            },
            {
                name: '郊区',
                textStyle: {
                    color: '#fff'
                }
            }]
        },
        // 设置页边距
        grid: {
            top: '10%',
            left: '3%',
            right: '5%',
            bottom: '5%',
            containLabel: true
        },
        calculable: true,
        xAxis: [
            {
                type: 'category',
                boundaryGap: false,
                data: ['2013年', '2014年', '2015年'],
                //设置坐标轴字体颜色  
                axisLabel: {
                    textStyle: {
                        color: '#fff'
                    }
                },
                //设置坐标轴颜色 
                axisLine: {
                    show: true,
                    lineStyle: {
                        color: 'yellow',
                        width: 2
                    }
                },
                splitLine: { show: false } //去掉背景网格
            }
        ],
        yAxis: [
            {
                type: 'value',
                min: 45,
                max: 60,
                yAxisIndex: 3, //刻度间隔
                //设置坐标轴字体颜色  
                axisLabel: {
                    textStyle: {
                        color: '#fff'
                    }
                },
                //设置坐标轴颜色 
                axisLine: {
                    show: true,
                    lineStyle: {
                        color: 'yellow',
                        width: 2
                    }
                },
                splitLine: { show: false } //去掉背景网格                
            }
        ],
        series: [
            {
                name: '城区',
                type: 'line',
                symbolSize: 10,
                data: [54.7, 53.8, 54.8],
                itemStyle: {
                    normal: {
                        lineStyle: {
                            width: 2
                            //color: 'yellow'
                        }
                    }
                }
            },
            {
                name: '郊区',
                type: 'line',
                symbolSize: 10,
                data: [51.4, 51.1, 54.6],
                itemStyle: {
                    normal: {
                        lineStyle: {
                            width: 2
                            //color: 'yellow'
                        }
                    }
                }
            }
        ]
    };
    myChart.setOption(option);
}

// 水质达标情况
function waterQuality() {
    var myChart = echarts.init(document.getElementById('waterQuality'));
    var option = {
        tooltip: {
            trigger: 'axis'
        },       
        calculable: true,
        // 设置页边距
        grid: {
            top: '5%',
            left: '3%',
            right: '5%',
            bottom: '7%',
            containLabel: true
        },
        xAxis: [
            {
                type: 'category',
                boundaryGap: false,
                data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
                //设置坐标轴字体颜色  
                axisLabel: {
                    textStyle: {
                        color: '#fff'
                    }
                },
                //设置坐标轴颜色 
                axisLine: {
                    lineStyle: {
                        color: 'yellow',
                        width: 2
                    }
                },
                splitLine: { show: false } //去掉背景网格
            }
        ],
        yAxis: [
            {
                type: 'value',
                //设置坐标轴字体颜色  
                axisLabel: {
                    textStyle: {
                        color: '#fff'
                    }
                },
                //设置坐标轴颜色
                axisLine: {
                    lineStyle: {
                        color: 'yellow',
                        width: 2
                    }
                },
                splitLine: { show: false } //去掉背景网格
            }
        ],
        color: ['#f20201', '#ec9301', '#05ff0a'],
        series: [
            {
                name: 'AOI',
                type: 'line',
                smooth: true,
                data: [220, 182, 191, 234, 290, 330, 310, 120, 150, 140, 210, 230]
            },
            {
                name: '降水量',
                type: 'line',
                smooth: true,
                data: [150, 232, 201, 154, 190, 330, 410, 420, 250, 230, 200, 210]
            },
            {
                name: '风速',
                type: 'line',
                smooth: true,
                data: [120, 132, 101, 134, 90, 230, 210, 120, 140, 178, 134, 112]
            }

        ]
    };

    myChart.setOption(option);
}

$.hb = {};
(function () {
    var _this = $.hb;
    $.extend($.hb, {

        fenxi_data_aqi: [],
        fenxi_data_pm25: [],
        fenxi_data_pm10: [],
        fenxi_data_so2: [],
        fenxi_data_no2: [],
        fenxi_data_co: [],
        fenxi_data_o3: [],
        fenxi_data_js: [],
        fenxi_data_fs: [],
        fenxi_data_ydl: [],
        setobjMonthPicTotal_fengxi: function () {
            var name;
            var x = [];
            var x_full = [];
            var id = null;

            //for (var i = 1; i < 31; i++) {
            for (var j = 0; j < $.demo.data.Year_2000[0].length; j++) {
                var time = new Date(parseInt($.demo.data.Year_2000[0][j].DAY.replace("/Date(", "").replace(")/", ""))).getDate();
                var t = new Date(parseInt($.demo.data.Year_2000[0][j].DAY.replace("/Date(", "").replace(")/", ""))).getMonth() + 1;
                //y = $.demo.data.Year_2000[0][j].SO2;
                //y = $.demo.data.Year_2000[0][j].NO2;
                //y = $.demo.data.Year_2000[0][j].CO;
                //y = $.demo.data.Year_2000[0][j].O3_8;
                $.demo.fenxi_data_aqi.push($.demo.data.Year_2000[0][j].AQI);
                $.demo.fenxi_data_pm25.push(parseFloat(($.demo.data.Year_2000[0][j].PM25).toFixed(2)));
                $.demo.fenxi_data_pm10.push(parseFloat(($.demo.data.Year_2000[0][j].PM10).toFixed(2)));
                $.demo.fenxi_data_so2.push(parseFloat(($.demo.data.Year_2000[0][j].SO2).toFixed(2)));
                $.demo.fenxi_data_no2.push(parseFloat(($.demo.data.Year_2000[0][j].NO2).toFixed(2)));
                $.demo.fenxi_data_co.push(parseFloat(($.demo.data.Year_2000[0][j].CO).toFixed(2)));
                $.demo.fenxi_data_o3.push(parseFloat(($.demo.data.Year_2000[0][j].O3_8).toFixed(2)));
                x.push(t + "/" + time);

                //data_gy.push(g);
                //data_wq.push(c);
                //data_fs.push(f);

            }

            for (var j = 0; j < $.demo.data.weather_data.length; j++) {
                //var time = new Date(parseInt($.demo.data.weather_data[j].time.replace("/Date(", "").replace(")/", ""))).getDate();
                $.demo.fenxi_data_js.push($.demo.data.weather_data[j].js);
                $.demo.fenxi_data_fs.push(parseFloat(($.demo.data.weather_data[j].fs).toFixed(1)));
            }

            for (var j = 0; j < $.demo.data.YDL.length; j++) {
                //var time = new Date(parseInt($.demo.data.YDL[j].Time.replace("/Date(", "").replace(")/", ""))).getDate();
                $.demo.fenxi_data_ydl.push(parseFloat((($.demo.data.YDL[j].Num) / 10000).toFixed(2)));
            }

            var u = new Date(parseInt($.demo.data.Year_2000[0][0].DAY.replace("/Date(", "").replace(")/", "")));
            var u_last = new Date(parseInt($.demo.data.Year_2000[0][$.demo.data.Year_2000[0].length - 1].DAY.replace("/Date(", "").replace(")/", "")));
            var time_index = u.getFullYear() + "年" + (u.getMonth() + 1) + "月" + u.getDate() + "日至" + u_last.getFullYear() + "年" + (u_last.getMonth() + 1) + "月" + u_last.getDate() + "日";
            //time_index = "12/23"+"&nbsp;&nbsp;&nbsp;"+ "21：00～" + "12/31"+ "&nbsp;&nbsp;&nbsp;"+ "23：00";
            $("#year_date").html("（" + time_index + "）</p>");

            $('#objMonthPicTotal_2').highcharts({
                chart: {
                    //plotBorderWidth: 2,
                    //plotBorderColor: '#fff',
                    backgroundColor: '#07437B',
                    marginTop: '0',
                    marginBottom: '0'
                },
                title: {
                    text: '',
                },
                legend: {
                    enabled: false,
                    //align: 'left',
                    ////verticalAlign: 'bottom',
                    //x: 40,
                    //y: 45
                },
                tooltip: {
                    shared: true,
                    crosshairs: true,
                },
                xAxis: {
                    categories: x,
                    lineColor: '#fff',
                    lineWidth: 2,
                    //type: 'datetime',
                    //maxZoom: 48 * 3600 * 1000,
                    labels: {
                        style: {
                            fontSize: '20px',
                            color: '#fff'
                        },
                        enabled: false,
                    }
                },
                yAxis: [{
                    lineColor: '#fff',
                    lineWidth: 2,
                    labels: {
                        y: 10,
                        style: {
                            fontSize: '20px',
                            color: '#fff'
                        },
                        enabled: false,
                    },
                    title: {
                        text: '',
                    },
                    plotLines: [{
                        value: 51,
                        color: 'yellow',
                        width: 1,
                        type: 'line',
                        dashStyle: 'dash',
                        //label: {
                        //    text: '良好',
                        //    align: 'left',
                        //    style: {
                        //        color: 'white'
                        //    }
                        //},
                        zIndex: 5
                    }, {
                        value: 151,
                        color: 'red',
                        width: 1,
                        type: 'line',
                        dashStyle: 'dash',
                        //label: {
                        //    text: '中等',
                        //    align: 'left',
                        //    style: {
                        //        color: 'white'
                        //    }
                        //},
                        zIndex: 5
                    }],
                    opposite: false

                }, { //工业
                    gridLineWidth: 0,
                    title: {
                        text: '',
                    },
                    mix: 25,
                    labels: {
                        enabled: false
                    }

                }, { //降水
                    gridLineWidth: 0,
                    max: 200,
                    min: 0,
                    title: {
                        text: '',
                    },
                    labels: {
                        enabled: false
                    }

                }, { // 风速
                    gridLineWidth: 0,
                    max: 20,
                    min: 0,
                    title: {
                        text: '',
                    },
                    labels: {
                        enabled: false

                    },
                    opposite: true
                }, { // 用电量
                    gridLineWidth: 0,
                    title: {
                        text: '',
                    },
                    labels: {
                        enabled: false

                    },
                    opposite: true
                }],
                plotOptions: {
                    areaspline: {
                        fillColor: {
                            linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
                            stops: [
                                [0, '#ec9301'],
                                [1, 'rgba(236, 147, 1,0.2)']
                            ]
                        },
                        marker: {
                            enabled: false
                        },
                        lineWidth: 3,
                        states: {
                            hover: {
                                lineWidth: 3
                            }
                        },
                        threshold: null
                    },
                    //areaspline: {
                    //    fillOpacity: 0.5
                    //}
                    spline: {
                        lineWidth: 3,
                        states: {
                            hover: {
                                lineWidth: 3
                            }
                        },
                        marker: {
                            enabled: false
                        },

                    }
                },
                series: [
                    {
                        name: '<div style="font-size:12px; color:white;">降水量</div>',
                        color: '#F20203',
                        yAxis: 2,
                        type: 'spline',
                        id: 'js_check_2',
                        lineWidth: 5,
                        //dashStyle: 'shortdot',
                        tooltip: {
                            valueSuffix: ' mm'
                        },
                        data: $.demo.fenxi_data_js,
                        //pointInterval: 24 * 3600 * 1000
                    },
                    //{
                    //    name: '<div style="font-size:12px; color:white;">风速</div>',
                    //    yAxis: 3,
                    //    id: 'fs_check_2',
                    //    color: '#05FF0A',
                    //    type: 'spline',
                    //    //dashStyle: 'dash',
                    //    lineWidth: 3,
                    //    tooltip: {
                    //        valueSuffix: ' 级'
                    //    },
                    //    data: $.demo.fenxi_data_fs,
                    //    //pointInterval: 24 * 3600 * 1000
                    //},
                    {
                        name: '<div style="font-size:12px; color:white;">PM2.5</div>',
                        color: '#05C3FF',
                        id: 'pm25_check_2',
                        type: 'spline',
                        lineWidth: 3,
                        tooltip: {
                            valueSuffix: ''
                        },
                        data: $.demo.fenxi_data_pm25,
                        //pointInterval: 24 * 3600 * 1000
                    },
                {
                    type: 'areaspline',
                    id: 'aqi_check_2',
                    name: '<div style="font-size:12px; color:white;">AQI</div>',
                    color: '#ffc524',
                    data: $.demo.fenxi_data_aqi,
                    //pointInterval: 24 * 3600 * 1000
                }]
            });
            //alert("YDL" + $.demo.fenxi_data_ydl.length)
        },


        data_aqi: [],
        data_pm25: [],
        data_pm10: [],
        data_so2: [],
        data_no2: [],
        data_co: [],
        data_o3: [],
        setobjMonthPicTotal: function (type) {
            var x = [];

            var id;
            var time_index;

            var color = "";
            for (var j = 0; j < $.demo.data.Hour_2000.length ; j++) {
                var time = new Date(parseInt($.demo.data.Hour_2000[j].HOUR.replace("/Date(", "").replace(")/", ""))).getHours();
                var y = $.demo.data.Hour_2000[j].AQI;
                var t = $.demo.data.Hour_2000[j].PM25;
                var p = $.demo.data.Hour_2000[j].PM10;
                var s = $.demo.data.Hour_2000[j].SO2;
                var n = $.demo.data.Hour_2000[j].NO2;
                var c = $.demo.data.Hour_2000[j].CO;
                var o = $.demo.data.Hour_2000[j].O3_8;

                _this.data_aqi.push(y)
                _this.data_pm25.push(t)
                _this.data_pm10.push(p)
                _this.data_so2.push(s)
                _this.data_no2.push(n)
                _this.data_co.push(c)
                _this.data_o3.push(o)
                x.push(time + ":00");
            }
            var u = new Date(parseInt($.demo.data.Hour_2000[0].HOUR.replace("/Date(", "").replace(")/", "")));
            var u_last = new Date(parseInt($.demo.data.Hour_2000[$.demo.data.Hour_2000.length - 1].HOUR.replace("/Date(", "").replace(")/", "")));
            time_index = (u_last.getMonth() + 1) + "月" + u_last.getDate() + "日" + u_last.getHours() + "时至" + (u.getMonth() + 1) + "月" + u.getDate() + "日" + u.getHours() + "时";
            //time_index = "12/23"+"&nbsp;&nbsp;&nbsp;"+ "21：00～" + "12/31"+ "&nbsp;&nbsp;&nbsp;"+ "23：00";

            var name_1 = "AQI";
            var name_2 = "PM2.5";
            x.reverse();
            _this.data_aqi = _this.data_aqi.reverse();
            _this.data_pm25 = _this.data_pm25.reverse();
            _this.data_pm10 = _this.data_pm10.reverse();
            _this.data_so2 = _this.data_so2.reverse();
            _this.data_no2 = _this.data_no2.reverse();
            _this.data_co = _this.data_co.reverse();
            _this.data_o3 = _this.data_o3.reverse();

            airMonitor(x, _this.data_aqi, _this.data_pm25, _this.data_o3)
        },

        Get_GYWR_TOP: function () {
            $.ajaxHandle({
                url: ACTION_URL("Get_GYWR_TOP", "Manager"),
                data: {
                },
                success: function (response) {
                    $.each(response, function (index, ele) {
                        $("#gy_name_" + (index + 1)).html(ele.NAME);
                        $("#cb_num_" + (index + 1)).html(ele.CB_SUM);
                        $("#so2_pfl_" + (index + 1)).html((ele.S02_PFL / 1000).toFixed(2));

                        //var paiming;
                        //if ((index + 1) > ele.LAST_NUM) {
                        //    paiming = CONTENT_URL("Content/images/go_down.png");
                        //} else if ((index + 1) == ele.LAST_NUM) {
                        //    paiming = CONTENT_URL("Content/images/go_ping.png");;
                        //} else if ((index + 1) < ele.LAST_NUM) {
                        //    paiming = CONTENT_URL("Content/images/go_up.png");
                        //}


                        //$("#pm_" + (index + 1)).html("<e style='font-size: 18px; color: white; width:20px; text-align:right;display:inline-block;'>" + (index + 1) + "</e><img style='margin-left:0px; height:15px; transform:rotateY(180deg);' src='" + paiming + "' /><e style='font-size: 18px;color: white; width:20px; text-align:left;display:inline-block;'>" + ele.LAST_NUM + "</e>");


                        if (ele.S02_CBPFL == 0) {
                            $("#so2_cb_pfl_" + (index + 1)).html("—");
                        } else {
                            $("#so2_cb_pfl_" + (index + 1)).html((ele.S02_CBPFL / 1000).toFixed(3));
                        }

                        $("#no_pfl_" + (index + 1)).html((ele.NO_PFL / 1000).toFixed(2));

                        if (ele.NO_CBPFL == 0) {
                            $("#no_cb_pfl_" + (index + 1)).html("—");
                        } else {
                            $("#no_cb_pfl_" + (index + 1)).html((ele.NO_CBPFL / 1000).toFixed(3));
                        }

                        $("#gy_name_" + (index + 1)).attr({ title: ele.NAME });
                    })
                    //var time = new Date(parseInt(response[0].DT.replace("/Date(", "").replace(")/", ""))).getMonth() + 1;
                    //$("#gywr_Mouth").html("南京市超标排污企业排名（" + time + "月）");
                }
            });
        },


        showClusterData_poi: function () {
            debugger;
            var param = {
                number: 10,
                radius: 1000
            }

            //this.map.clear();

            var _markers = [];
            var _markers_1 = [];
            var _markers_2 = [];

            $.each($.demo.data.AQI_List[0], function (index, n) {
                var d_id;
                switch (n.DimManageLevelID) {
                    case 0:
                        d_id = "";
                        break;
                    case 1:
                        d_id = "国控";
                        break;
                    case 2:
                        d_id = "省控";
                        break;
                    default:

                }

                //var time = new Date(parseInt(n.T_Stamp.replace("/Date(", "").replace(")/", "")));
                if (n.Longitude != 0 && n.Latitude != 0) {
                    var aqi;
                    switch (n.ID) {
                        case 2001:
                            aqi = $.demo.data.Hour_2001[0].AQI;
                            break;
                        case 2002:
                            aqi = $.demo.data.Hour_2002[0].AQI;
                            break;
                        case 2003:
                            aqi = $.demo.data.Hour_2003[0].AQI;
                            break;
                        case 2004:
                            aqi = $.demo.data.Hour_2004[0].AQI;
                            break;
                        case 2006:
                            aqi = $.demo.data.Hour_2006[0].AQI;
                            break;
                        case 2007:
                            aqi = $.demo.data.Hour_2007[0].AQI;
                            break;
                        case 2008:
                            aqi = $.demo.data.Hour_2008[0].AQI;
                            break;
                        case 2009:
                            aqi = $.demo.data.Hour_2009[0].AQI;
                            break;
                        case 2010:
                            aqi = $.demo.data.Hour_2010[0].AQI;
                            break;
                        case 2013:
                            aqi = $.demo.data.Hour_2013[0].AQI;
                            break;
                        case 2016:
                            aqi = $.demo.data.Hour_2016[0].AQI;
                            break;
                        case 2022:
                            aqi = $.demo.data.Hour_2022[0].AQI;
                            break;
                        case 2024:
                            aqi = $.demo.data.Hour_2024[0].AQI;
                            break;
                        default:

                    }

                    var _m = $.demo.map.addCssMarker(n.Longitude, n.Latitude, {
                        addToMapFlag: false,
                        type: "A1",
                        param_A1: {
                            height: 48,
                            width: 48,
                            bgColor: "rgba(2,131,206,0.9)",
                            //bgHoverColor: "rgba(255,106,0,0.9)",
                            //iconUrl: CONTENT_URL("Content/images/a_07_k.png"),
                            iconHtml: "<p style='font-size:25px;color:white; text-align:center; margin-top:15px;'>" + aqi + "</p>"
                        },
                        popule: {},
                        event: {
                            "click": function () {
                                $.demo.map.setView(n.Longitude, n.Latitude + 0.01, 14);
                            },
                        },
                    });
                    _markers.push(_m);
                }
            });

            //$.each($.demo.data.wq_List[0], function (index, e) {
            //    if (e.code == "NJWQ0002" || e.code == "NJWQ0004" || e.code == "NJWQ0007" || e.code == "NJWQ0012") {
            //        var time = new Date(parseInt(e.T_Stamp.replace("/Date(", "").replace(")/", "")));
            //        var _m = $.demo.map.addCssMarker(e.Latitude, e.Longitude, {
            //            addToMapFlag: false,
            //            type: "A1",
            //            param_A1: {
            //                height: 48,
            //                width: 48,
            //                bgColor: "rgba(90,171,24,0.9)",
            //                //bgHoverColor: "rgba(255,106,0,0.9)",
            //                iconUrl: CONTENT_URL("Content/images/a_03_k.png"),
            //            },
            //            event: {
            //                "click": function () {
            //                    $.demo.map.setView(e.Latitude, e.Longitude + 0.01, 14);
            //                },
            //            },

            //        });
            //        _markers_1.push(_m);
            //    }
            //});

            //$.each($.demo.data.GY_pollution, function (index, f) {
            //    //var time = new Date(parseInt(f.T_Stamp.replace("/Date(", "").replace(")/", "")));
            //    //var name = substring(15, f.site_name) + "...";
            //    //alert(name);
            //    if (f.site_name.length > 15) {
            //        f.site_name = f.site_name.substring(0, 15);
            //    }
            //    var _m = $.demo.map.addCssMarker(f.Latitude, f.Longitude, {
            //        addToMapFlag: false,
            //        type: "A1",
            //        param_A1: {
            //            height: 48,
            //            width: 48,
            //            bgColor: "rgba(203,39,0,0.9)",
            //            //bgHoverColor: "rgba(255,106,0,0.9)",
            //            iconUrl: CONTENT_URL("Content/images/a_13.png"),
            //        },
            //        event: {
            //            "click": function () {
            //                //$.demo.map.setView(f.Latitude, f.Longitude, 14);
            //            },
            //        },

            //    });
            //    _markers_2.push(_m);
            //});


        },

    })
})(jQuery);